
<template>
  <swiper class='home-swiper'>
    <swiper-item v-for=" (v,i) in banners" :key="i">
      <a :href="v.link">
        <img :src='v.image' @load='imageLoad'>
      </a>
    </swiper-item>
  </swiper>
</template>

<script>
import { Swiper, SwiperItem } from 'components/common/swiper/index.js'
export default {
  components: { Swiper, SwiperItem },
  props: {
    banners: {
      type: Array,
      default() {
        return []
      }
    }
  },
  data() {
    return {
      flag: false
    }
  },
  methods: {
    imageLoad() {
      if (!this.flag) {
        this.$emit('imgLoad')
        this.flag = true
      }
    }
  }
}
</script>

<style scoped>
.home-swiper {
  height: 199px;
}
.home-swiper a {
  display: inline-block;
}
</style>